package com.polaris.live.constant

import androidx.annotation.IntDef
import com.polaris.live.im.sfs.bean.live.CallSignalingMessage
import com.polaris.live.im.sfs.bean.live.LiveRoomInfo
import com.polaris.live.im.sfs.bean.live.ext.UserBasicVo
import com.polaris.live.im.sfs.bean.pusher.NoticeMatchMessage
import com.polaris.live.resp.back_resp.CallStartResp
import com.polaris.live.resp.back_resp.CallVo
import com.polaris.live.resp.back_resp.LiveStopReceiptResp
import com.polaris.live.resp.back_resp.ScreenshotStrategyVo
import com.polaris.live.ui.live.bean.LiveInitInfo

/**
 * LiveConst
 *
 * @author Created by lucas on 2023/11/10 15:07
 */
object LiveConst {

    //15秒定时
    const val ANSWER_TIMEOUT = 15 * 1000L

    //心跳上报
    const val HEARTBEAT_TIME = 5 * 1000L

    //触发人脸报警的延迟时间
    const val FACE_TRIGGER_DELAY = 3 * 1000L

    //关闭的延迟时间
    const val FACE_STOP_DELAY = 10 * 1000L

    //默认直播通话结束等待时间
    const val LIVE_END_WAIT_PERIOD = 5 * 1000L

    //直播延迟显示关闭按钮的时间
    const val LIVE_SHOW_CLOSE_DELAY = 20000L

    //直播前更新顶部房间列表人数时间
    const val PARTY_LIST_TIME = 10 * 1000L

    //翻译常量      这里一定要用9个字符哈   就算是定的协议了
    const val ZEGOTI = "zegoa2ti:"                   //翻译中
    const val ZEGOTD = "zegoa2td:"                   //翻译结束
    const val ZEGONUM = 9

    //礼物类型
    object GiftType {

        const val NORMAL_GIFT = 1                   //普通礼物
        const val LUCK_GIFT = 1 shl 1                     //幸运礼物
        const val FOLLOWER_GIFT = 1 shl 2                 //关注礼物
        const val FREE_GIFT = 1 shl 3                     //免费礼物
        const val GAME_BEANS_GIFT = 1 shl 4              //游戏币礼物
        const val LUCK_BACKPACK = 1 shl 5              //背包幸运礼物
        const val CUSTOMIZED = 1 shl 6              //定制礼物
        const val GIFT_PRIVILEGE = 1 shl 7           //特权礼物
    }

    //礼物payload业务类型
    object GiftPrivilegeType {

        const val VIP = 1                            //vip
        const val BIRTHDAY = 2                       //生日
        const val MYSTERY_MAN = 3                    //神秘人不用id
    }

    //赠送礼物类型
    object SendGift {

        const val commonGift = 0                    //赠送普通礼物  就是无需处理
        const val publicGift = 1                    //赠送公屏礼物  无需触发连点按钮
        const val giftPopup = 2                     //赠送礼物弹窗里的礼物 需要触发连点按钮
        const val followerGift = 3                  //赠送关注礼物 赠送后需要修改关注状态以及更新公屏的消息
    }

    //通话请求来源
    object SenderFrom {

        const val MANUAL = 1//手动
        const val MATCH = 2//匹配
        const val INVITE = 3//邀约
    }

    @IntDef(
        SenderFrom.MANUAL,
        SenderFrom.MATCH,
        SenderFrom.INVITE
    )
    annotation class SenderFormType

    /**
     * 后台的类型
     */
    object Type {

        /**
         * 直播且坐等
         */
        const val LIVE_AND_MATCH = 1

        /**
         * 仅坐等
         */
        const val ONLY_MATCH = 2

        /**
         * 仅直播
         */
        const val ONLY_LIVE = 3

        /**
         * 语言房
         */
        const val PARTY_LIVE = 4

        /**
         * 游戏派对
         */
        const val PARTY_GAME_LIVE = 5

        /**
         * 视频派对
         */
        const val VIDEO_PARTY = 6

        /**
         * 拨打类型      这个match 是客户端自己用的type 因为直播且坐等和拨打都把这个1占上了
         */
        const val CLIENT_MATCH = 100

        /**
         * 默认 这个-1是封面照的东西  因为开播的时候需要判断有没有封面照所有需要传参  如果是-1就不需要开直播什么的了只是单纯设置封面照
         */
        const val CLIENT_DEFAULT = -1
    }

    @IntDef(
        Type.LIVE_AND_MATCH,
        Type.ONLY_MATCH,
        Type.ONLY_LIVE,
        Type.PARTY_LIVE,
        Type.PARTY_GAME_LIVE,
        Type.VIDEO_PARTY,
    )
    annotation class LiveType

    /**
     * 请求接口类型
     */
    object RequestLiveType {

        const val PARTY = 1
        const val GAME = 2
    }

    @IntDef(
        RequestLiveType.PARTY,
        RequestLiveType.GAME,
    )
    annotation class RequestType

    object GameType {

        const val LUDO = 1
        const val UNNO = 2
        const val DOMINO = 3
        const val BLACK8 = 4
        const val UNOPRO = 5
        const val JELLYBOOM = 6

    }

    @IntDef(
        GameType.LUDO,
        GameType.UNNO,
        GameType.DOMINO,
        GameType.BLACK8,
        GameType.UNOPRO,
        GameType.JELLYBOOM,
    )
    annotation class PartyGameType

    object GameName {

        const val LUDO = "LUDO"
        const val UNNO = "UNNO"
        const val DOMINO = "DOMINO"
        const val BLACK8 = "8BALL"
        const val UNOPRO = "UNNO"
        const val JELLYBOOM = "JELLYBOOM"
    }

    object GameBusinessType {

        const val LIVE = 0
        const val CALL = 1

    }

    @IntDef(
        GameBusinessType.CALL,
        GameBusinessType.LIVE,
    )
    annotation class BusinessType

    /**
     * 页面类型
     */
    object Page {

        /**
         * 仅坐等
         */
        const val LIVE_MATCH = 0

        /**
         * 直播主播
         */
        const val LIVE_ANCHOR = 1

        /**
         * 直播观众
         */
        const val LIVE_SPECTATOR = 2

        /**
         * 通话
         */
        const val CALL = 3

        /**
         * 视频派对ANCHOR
         */
        const val VIDEO_PARTY_ANCHOR = 4

        /**
         * 视频派对SPECTATOR
         */
        const val VIDEO_PARTY_SPECTATOR = 5
    }

    @IntDef(
        Page.LIVE_MATCH,
        Page.LIVE_ANCHOR,
        Page.LIVE_SPECTATOR,
        Page.CALL,
        Page.VIDEO_PARTY_ANCHOR,
        Page.VIDEO_PARTY_SPECTATOR
    )
    annotation class LivePage

    /**
     * 直播状态
     */
    object State {

        /**
         * 正常状态
         */
        const val NONE = 0

        /**
         * 仅直播中
         */
        const val ONLY_LIVE = 1

        /**
         * 坐等中，可能同时在直播中，这里使用同一个状态
         */
        const val LIVE_AND_MATCH = 2

        /**
         * 通话中
         */
        const val CALL = 3

        /**
         * 通话中
         */
        const val PARTY = 4

    }

    @IntDef(State.NONE, State.ONLY_LIVE, State.LIVE_AND_MATCH, State.CALL, State.PARTY)
    annotation class LiveState

    /**
     * 通话结束的接口endType
     */
    object CloseType {

        /**
         * 正常关闭
         */
        const val END = 1

        /**
         * 手动取消
         */
        const val CANCEL = 2

        /**
         * 超时未接听
         */
        const val TIMEOUT = 3

        /**
         * 用户异常结束
         */
        const val ERROR = 98
    }

    @IntDef(CloseType.END, CloseType.CANCEL, CloseType.TIMEOUT, CloseType.ERROR)
    annotation class CallCloseType

    /**
     * 通话接听类型
     */
    object AnswerType {

        /**
         * 同意
         */
        const val AGREE = 1

        /**
         * 拒绝
         */
        const val REFUSE = 2
    }

    @IntDef(AnswerType.AGREE, AnswerType.REFUSE)
    annotation class CallAnswerType

    /**
     * 通话角色
     */
    object CallRole {

        /**
         * 主叫
         */
        const val CALLER = 0

        /**
         * 被叫
         */
        const val ANSWER = 1

    }

    object CallState {

        /**
         * 已获取（待接通）
         */
        const val START = 100

        /**
         * 对方已应答
         */
        const val ANSWER = 101

        /**
         * 应答方调用了connected
         */
        const val ANSWER_CONNECTED = 102

        /**
         * 发起方调用了connected
         */
        const val CALLER_CONNECTED = 103

        /**
         * 已接通(通话中)，2个connect都通了
         */
        const val CONNECTED = 200

        /**
         * 已结束
         */
        const val OVER = 300

        /**
         * 被拒绝
         */
        const val REFUSE = 301

        /**
         * 已取消
         */
        const val CANCEL = 302

        /**
         * 超时未接通
         */
        const val NO_ANSWER = 310

        /**
         * 对方忙
         */
        const val BUSY = 400

        /**
         * 对方离线
         */
        const val OFFLINE = 410

        /**
         * 无余额
         */
        const val INSUFFICIENT_BALANCE = 420

        /**
         * 拨打成功的状态
         */
        val successStates = setOf(
            START,
            INSUFFICIENT_BALANCE,
        )

    }

    @IntDef(
        CallState.START,
        CallState.ANSWER,
        CallState.ANSWER_CONNECTED,
        CallState.CALLER_CONNECTED,
        CallState.CONNECTED,
        CallState.OVER,
        CallState.REFUSE,
        CallState.CANCEL,
        CallState.NO_ANSWER,
        CallState.BUSY,
        CallState.OFFLINE,
        CallState.INSUFFICIENT_BALANCE
    )
    annotation class CallStateType

    object Params {

        /**
         * 截图信息[ScreenshotStrategyVo]
         */
        const val SCREENSHOT_STRATEGY = "screenshotStrategy"

        /**
         * 直播初始化信息[LiveInitInfo]
         */
        const val LIVE_INIT_INFO = "variable"

        /**
         * 直播信息[LiveRoomInfo]
         */
        const val LIVE_INFO = "liveInfo"

        /**
         * 直播类型[Int]
         */
        const val LIVE_TYPE = "type"

        /**
         * 直播结束信息[LiveStopReceiptResp]
         */
        const val LIVE_END_INFO = "data"

        /**
         * 电话拨打方信息[CallStartResp]
         */
        const val CALL_BEAN = "callBean"

        /**
         * 电话接收方信息[CallSignalingMessage]
         */
        const val CALL_MESSAGE = "callMessage"

        /**
         * 视频邀约信息[NoticeMatchMessage]
         */
        const val NOTICE_MATCH_MESSAGE = "NoticeMatchMessage"

        /**
         * 电话基本信息[CallVo]
         */
        const val CALL_INFO = "callInfo"

        /**
         * 对方的基本信息[UserBasicVo]
         */
        const val CALL_USER_BASIC = "callUserBasic"

        /**
         * 是否需要同意[Boolean]
         */
        const val CALL_NEED_AGREE = "needAgree"

        /**
         * 是否需要倒计时[Boolean]
         */
        const val CALL_NEED_COUNTDOWN = "needCountdown"

        /**
         * 通话身份[Int]
         */
        const val CALL_ROLE = "role"

        /**
         * 通话来源
         */
        const val CALL_FROM_TYPE = "fromType"

        /**
         * 当前页面
         */
        const val CALL_LAST_FROM_TYPE = "lastFromType"

        /**
         * 是否能点击头像跳转
         */
        const val NEED_CLICK_AVATAR = "needClickAvatar"

        /**
         * 是不是房主
         */
        const val IS_ANCHORID = "isAnchorid"

        /**
         * 是不是从匹配过来的 目前仅游戏房匹配用
         */
        const val IS_MATCH_COME_GAME = "isMatchCome"

        /**
         * 游戏房声音控制  目前仅游戏房匹配用
         *
         * 是否禁用声音
         */
        const val SOUND_STATUS = "soundStatus"

        /**
         * 房主 ID
         *
         */
        const val ANCHORID = "anchorId"

        /**
         * 直播类型
         *
         */
        const val LIVETYPE = "liveType"

        /**
         * 房间id
         */
        const val ROOMID = "roomId"

        /**
         * 直播初始化信息[LiveInitInfo]
         */
        const val LIVEINITINFO = "liveInitInfo"
    }

    object NoticeImageType {

        const val IMAGE = 1     //图片
        const val PAG = 2       //pag
    }

    /**
     * 主题样式
     */
    object THEME_TYPE {

        /**
         * 默认
         */
        const val THEME_DEFAULT = 0

        /**
         * 帝王房
         */
        const val LIVE_PARTY_THEME_EMPEROR = 1101

        /**
         * CP房
         */
        const val LIVE_PARTY_THEME_COUPLE = 1201

        /**
         * 荣耀房
         */
        const val LIVE_PARTY_THEME_HONOR = 1202

        /**
         * 至尊房
         */
        const val LIVE_PARTY_THEME_SUPREME = 1301

        /**
         * 娱乐房
         */
        const val LIVE_PARTY_THEME_AMUSEMENT = 1501

    }

    /**
     * 礼物类型 (1普通礼物 2幸运礼物 4关注礼物 8免费礼物 16游戏币礼物 32背包幸运礼物)
     * @see GiftType
     */

    const val REGULAR_GIFT = 1L                     //1普通礼物
    const val LUCKY_GIFTS = 1L shl 1                //2幸运礼物
    const val FOLLOW_GIFTS = 1L shl 2               //4关注礼物
    const val FREE_GIFTS = 1L shl 3                 //8免费礼物
    const val GAME_COIN_GIFT = 1L shl 4             //16游戏币礼物
    const val LUCKY_BACKPACK_GIFT = 1L shl 5        //32背包幸运礼物

    object RoomType {

        const val NORMAL = 0        //普通
        const val AGENCY = 1        //公会
        const val OFFICIAL = 2      //官方
    }

}